﻿<?php
/**
 * 数据服务器配置文件
 * User: xbx
 * Date: 2018/3/1
 * Time: 14:41
 */
return array(
    'server' => array(
        "reactor_num"=> CPU_NUM,
        "worker_num"=> CPU_NUM, // * 4,
        'task_worker_num' => CPU_NUM, // 第一个task处理cannal pop all  swoole_cpu_num()
//        'task_ipc_mode' => 3, // 1, 使用unix socket通信，默认模式  2, 使用消息队列通信  3, 使用消息队列通信，并设置为争抢模式
        "daemonize"=>false,
        'pid_file' => __DIR__.'/data.pid',
        "log_file" => __DIR__ . '/log/data.log',//daemonize=>true以后
        "log_level" => 4,
//        'max_request' => 10000,
        'dispatch_mode' => 2,//默认2
//        'enable_unsafe_event'=>true, //dispatch_mode 1和3时启用

        'reload_async'=>true,
        'max_wait_time' => 30,
//
//        'open_cpu_affinity'=>1,
//        'cpu_affinity_ignore' => array(0,1),// //表示不使用CPU0,CPU1

        'package_max_length' => 4096,//8192  65535
        'open_length_check'=> true,
        'package_length_offset' => 2,// 最大长度定义 #define SW_BUFFER_SIZE    65535  FFFF
        'package_body_offset' => 0,
        'package_length_type' => 'n',

//
//        //字符串首字符串粘包处理
//        'open_front_check' => false,
//        'open_front_split' => false,
//        'package_front' => '2004',

        'heartbeat_check_interval' => 10,
        'heartbeat_idle_time' => 120,

        'open_tcp_keepalive'=>1,
        'tcp_keepidle'=>5,
        'tcp_keepcount'=>3,
        'tcp_keepinterval'=>5,

        'open_tcp_nodelay'=>1
    ),

    'listener' => array(
        "reactor_num"=>1,
        "worker_num"=>1,
//        'task_worker_num' =>1, // 第一个task处理cannal pop all  swoole_cpu_num()
        "daemonize"=>false,
        "log_file" => __DIR__ . '/log/datalistener.log',//daemonize=>true以后
        "log_level" => 0,
        'max_request' => 0,
        'dispatch_mode' => 2,
        'debug_mode'=> 1,

        'open_eof_split' => true,
        'package_eof' => PHP_EOL,
      //  'ssl_cert_file' => 'ssl.cert',
      //  'ssl_key_file' => 'ssl.key',

    ),

);
